//
//  GS_MoreHeroTopViewController.m
//  GoodManNews
//
//  Created by dllo on 16/1/14.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "GS_MoreHeroTopViewController.h"
#import "GS_MoreCollectionViewCell.h"
#import "GS_HeroTopViewController.h"

@interface GS_MoreHeroTopViewController () <UICollectionViewDataSource, UICollectionViewDelegate>

@property (nonatomic, retain) UICollectionView *collectionV;

@end

@implementation GS_MoreHeroTopViewController

- (void)dealloc
{
    [_collectionV release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor purpleColor];
    [self createCollectionView];
    
    
}

- (void)createCollectionView
{
    UICollectionViewFlowLayout *flowlayout = [UICollectionViewFlowLayout new];
    
    flowlayout.itemSize = CGSizeMake(self.view.bounds.size.width / 4, self.view.bounds.size.width / 4);
    flowlayout.sectionInset = UIEdgeInsetsMake(1, 0, 0, 0);
    flowlayout.minimumInteritemSpacing = 0;
    flowlayout.minimumLineSpacing = 0;
    self.collectionV = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowlayout];
    self.collectionV.backgroundColor = [UIColor whiteColor];
    
    //    self.heroCollectionView.contentOffset = CGPointMake(0, self.view.bounds.size.height / 15);
    [self.view addSubview:self.collectionV];
    
    [self.collectionV mas_makeConstraints:^(MASConstraintMaker *make) {
//                make.edges.equalTo(self.view);
        make.top.equalTo(self.view).with.offset(49);
        make.left.right.and.bottom.equalTo(self.view);
    }];
    self.collectionV.delegate = self;
    self.collectionV.dataSource = self;
    
    [self.collectionV registerClass:[GS_MoreCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    

}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section

{
    return 4;
    
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    GS_MoreCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    cell.backgroundColor = [UIColor whiteColor];
    cell.layer.borderColor=[UIColor darkGrayColor].CGColor;
    cell.layer.borderWidth=0.3;
    if (0 == indexPath.row) {
        cell.titleL.text = @"英雄排行榜";
        cell.backgroundColor = [UIColor whiteColor];
        cell.imageV.image = [UIImage imageNamed:@"30"];
    } else if (1 == indexPath.row) {
        cell.titleL.text = @"战斗力查询";
        cell.backgroundColor = [UIColor whiteColor];
        cell.imageV.image = [UIImage imageNamed:@"31"];
    } else {
        cell.titleL.text = @"敬请期待";
    }
    
    
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (0 == indexPath.row) {
        
        [self.delegate jumpToHeroTopVC];
    }
    if (1 == indexPath.row) {
        [self.EffDelegate jumpToEffectivenessVC];
    }
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
